﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;

namespace Xejen.Hosting.Extensions
{
    /// <summary>
    /// 针对<see cref="IAppHost"/>进行扩展
    /// </summary>
    /// <creator>marc</creator>
    public static class AppHostExtensions
    {
        /// <summary>
        /// 添加服务
        /// </summary>
        /// <param name="appHost"><inheritdoc cref="IAppHost" path="/summary"/></param>
        /// <param name="configure">服务配置的行为</param>
        /// <returns></returns>
        public static IAppHost AddServices(this IAppHost appHost, Action<IServiceCollection> configure)
        {
            configure.Invoke(((AppHostBase)appHost).Services);

            return appHost;
        }
    }
}
